#!/usr/bin/env python
# -*- coding:utf-8 -*-

import time

class Elapse_time(object):
    '''耗时统计工具'''
    def __init__(self, prompt=''):
        self.prompt = prompt
        self.start = time.time()
        
    def __del__(self):
        print('%s耗时: %.3f' % (self.prompt, time.time() - self.start))
CElapseTime = Elapse_time

import importlib
import time
import aaa
import os
last_time = None


def reload_config():
    pass

def my_import_module(name):
    global last_time
    file_time = os.path.getmtime(aaa.__file__)
    if file_time != last_time:
        print('重新加载')
        last_time = file_time
        importlib.reload(aaa)
   
    #print(aaa.a)

def main():
    
    elapse_time = Elapse_time('aaaa')
    for i in range(100000):
        my_import_module('aaa')
        #time.sleep(5)

if __name__ == '__main__':
    main()